﻿@model abc.Models.ContactInformation
@{
    ViewBag.Title = "ShowContactInforamtion";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<!---Panel View--->
<div class="col-md-12">
    <!---Personal Information VIew--->
    <div class="box box-info">
        <div class="box-header with-border">
            <h3 class="box-title">Personal Information</h3>
            <div class="box-tools pull-right">
                <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
            </div>
        </div><!-- /.box-header -->
        <div class="box-body">
            <div class="table-responsive">
                <table class="table no-margin">
                    <thead>
                        <tr>
                            <th>State Name</th>
                            <th>City Name</th>
                            <th>Address</th>
                            <th>Mobile Number</th>
                            <th>Alternate Mobile</th>
                            <th>E-mail Address</th>
                        </tr>
                    </thead>
              @{ 
                  foreach (var item in ViewBag.GetContactInformationByRegistrationId)
                {
                     <tbody>
                        <tr>
                            <td>@item.State.State_Name</td>
                            <td>@item.City.City_Name</td>
                            <td> @item.ContactInformation_Address</td>
                            <td>@item.ContactInformation_MobileNo</td>
                            <td>@item.ContactInformation_AlternateMobileNo</td>
                            <td>@item.ContactInformation_EmailId</td>
                            <td>
                                @{
                    using (Html.BeginForm("EditContactInformation", "RecruitmentZone", FormMethod.Post))
                    {
                        <input type="hidden" id="ContactInformation_Id" name="ContactInformation_Id" value="@item.ContactInformation_Id" />
                                    <input type="submit" class="btn btn-default btn-sm" value="Edit" />
                    }
                                }
                            </td>


                        </tr>


                    </tbody>
                }
                
                  
               }
                   
                </table>
            </div><!-- /.table-responsive -->
        </div><!-- /.box-body -->
        <div class="box-footer clearfix">
        @if (ViewBag.GetContactInformationByRegistrationId==null)
        {
              <a href="#" class="btn btn-sm btn-info btn-flat pull-left" data-toggle="modal" data-target="#call-CI">Add Contact Info</a>
        }
        else
        {<a href="#" class="btn btn-sm btn-info disabled btn-flat pull-left" data-toggle="modal" data-target="#call-CI">Add Contact Info</a>
            
        }
            <a href="#" class="btn btn-sm btn-default btn-flat pull-right">Cancel</a>
        </div><!-- /.box-footer -->
    </div>
</div>
<!------------------------------------------------------------------------------------------->
<!---Modal View--->

<div id="CI-modal">
<div class="modal modal-primary modal fade" tabindex="-1" id="call-CI"  data-keyboard="false"data-backdrop="false"  >
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="contact-information">Contact Information</h4>
                </div>
    @{
        using (@Html.BeginForm("SaveContactInformation", "RecruitmentZone", FormMethod.Post, new { @class = "form-horizontal" }))
            {


               <div class="modal-body">
               

               <div class="form-group">
               <label for="state" class="col-sm-3 control-label">State</label>
               <div class="col-sm-9">
                   <input type="hidden" name="ContactInformation_Id" id="ContactInformation_Id" value="@Model.ContactInformation_Id" />
           @Html.DropDownListFor(d => d.ContactInformation_StateId, (List<SelectListItem>)ViewBag.GetAllStates, new { @class = "form-control",@id="GetStateDropdownData" })   
                <br />
                @*<input type="button" class="btn btn-primary btn-lg " name="name" value="Submit " />*@
            
                </div>
        </div>

        <div class="form-group">
            <label for="City" class="col-sm-3 control-label">City</label>
            <div class="col-sm-9">
                @Html.DropDownListFor(d => d.ContactInformation_CityId, new SelectList(Enumerable.Empty<SelectListItem>(), "ContactInformation_CityId", "City.City_Name"),"-Please Select-", new { @class = "form-control", @id = "GetCityDropDownData" })
                <br />
                @*<input type="button" class="btn btn-primary btn-lg " name="name" value="Submit " />*@
            </div>
        </div>


        <div class="form-group">
            <label for="Address" class="col-sm-3 control-label">Address</label>
            <div class="col-sm-9">
                @Html.TextAreaFor(m => m.ContactInformation_Address, new {@placeholder="Address",@class="form-control" })
                @*<textarea class="form-control"  placeholder="Address"></textarea>*@
            </div>
        </div>
        <div class="form-group">
            <label for="Mobile" class="col-sm-3 control-label">Mobile</label>
            <div class="col-sm-9">
                @Html.TextBoxFor(d => d.ContactInformation_MobileNo, new { @placeholder = "Mobile No", @class = "form-control" })
                @*<input type="text" class="form-control" value="@Model.ContactInformation_MobileNo" name="name" placeholder="Mobile" />*@
            </div>
        </div>

        <div class="form-group">
            <label for="Mobile" class="col-sm-3 control-label">Alternate Mobile</label>
            <div class="col-sm-9">
                @Html.TextBoxFor(d => d.ContactInformation_AlternateMobileNo, new { @placeholder = "Alternate Mobile No", @class = "form-control" })
                @*<input type="text" value="@Model.ContactInformation_AlternateMobileNo" class="form-control" placeholder="Alternate Mobile" />*@
            </div>
        </div>
        <div class="form-group">
            <label for="Email" class="col-sm-3 control-label">E-mail</label>
            <div class="col-sm-9">
                @Html.TextBoxFor(d => d.ContactInformation_EmailId, new { @placeholder = "EmailId", @class = "form-control" })
                @*<input type="text" value="@Model.ContactInformation_EmailId"class="form-control" placeholder="E-mail" />*@
            </div>
        </div>
   
        </div>
<div class="modal-footer">
    <div class="pull-right">
        <button type="button" class="btn btn-outline pull-left " aria-hidden="true" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-outline">Save changes</button>
    </div>
</div>

    }
            }
</div>
        </div>
    </div>

</div>


  @section scripts
{
    <script>
        $(document).ready(function () {
            var Id = $("#ContactInformation_Id").val();
            if ($("#GetStateDropdownData").val() != 0) {
                var Sid = $("#GetStateDropdownData").val();
                $.getJSON("/RecruitmentZone/LoadCityByState", { StateId: Sid },
                       function (data) {
                           var select = $("#GetCityDropDownData");

                           $.each(data, function (index, CityData) {
                               select.append($('<option/>', {
                                   value: CityData.Value,
                                   text: CityData.Text

                               }));
                           });
                       });
                $("#CityDropDownData").val($("ContactInformation_Id").val());
            }
            $("#GetStateDropdownData").on('change', function () {
                var Sid = $(this).val();

                $.getJSON("/RecruitmentZone/LoadCityByState", { StateId: Sid },
                       function (data) {
                           var select = $("#GetCityDropDownData");
                           select.empty();
                           select.append($('<option/>', {
                               value: 0,
                               text: "-Please Select-"
                           }));
                           $.each(data, function (index, CityData) {
                               select.append($('<option/>', {
                                   value: CityData.Value,
                                   text: CityData.Text
                               }));
                           });
                       });
            });

        });
    </script>
}


